package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryDebug;
import com.nbsaas.boot.data.api.domain.request.QueryDebugRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.data.data.entity.QueryTemplate;

/**
* 调试记录请求对象转换成实体对象
*/

public class QueryDebugEntityConvert  implements Converter<QueryDebug, QueryDebugRequest> {

    @Override
    public QueryDebug convert(QueryDebugRequest source) {
        QueryDebug result = new QueryDebug();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getQueryTemplate()!=null){
                    QueryTemplate queryTemplate =new QueryTemplate();
                    queryTemplate.setId(source.getQueryTemplate());
                    result.setQueryTemplate(queryTemplate);
                    }
        return result;
    }
}

